var huizongbiao = new Vue({
    el : '#Huizongbiaolist',
    data:{
        xiangmuId : $("#xiangmuId").val(),
        xiangmu : {},
        HuizongbiaoList : [],
        show : false,
        total:0,
        usernum:'',

    },
    created : function() {
        var _this = this;
        $(".nav navbar-nav li").removeClass("active");
        $("#nav_huizongbiao").addClass("active");
        _this.findIsacticed();
        //_this.bindHuizongbiaoList();
    },
    methods : {

        findIsacticed:function (){
            var _this = this;
            layer.open({type:3});
            $.post('/xiangmu/find_one', {
                xianmguid:_this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        var data = ppData.resultContent;
                        _this.xiangmu = data;
                        _this.usernum = data.zhuangjiashu;
                        _this.bindHuizongbiaoList();

                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },

        bindHuizongbiaoList:function (){
            var _this = this;
            layer.open({type:3});
            $.post("/shengchanqiyezhongjianjieguo/getHuizongbiao",{
                xiangmuid : _this.xiangmuId,
                pageindex:1,
                pagesize:9999,
                rdm : Math.random()
            },function(ppData){
                layer.closeAll("loading");
                if (ppData != null){
                    if(ppData.result == "1"){
                        var data=ppData.resultContent;
                        var mmHtml = "<div class='table-head'><table class=\"table table-hover table-bordered\" style=\"overflow:hidden; margin-bottom:10px;table-layout:fixed;\" v-if=\"show\" cellspacing=\"0\" cellpadding=\"0\">\n" +
                            "   <thead >\n" +
                            "    <tr style=\"font-weight: bold;\">\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\">品种序号</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\">药品分类</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >药品品名</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >剂型</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\">规格序号</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:80px;\" rowspan=\"2\" >药品名称</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:80px;\" rowspan=\"2\" >规格</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >单位</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >医保类别</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\"  >上级检查通报</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\"  >未挂网</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >无配送企业</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >原国谈</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >通过一致性评价</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >国家保密配方</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >中药保护品种</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >价格（元）</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" >原研</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >基药</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >集采</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\" >院本部</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:50px;\" rowspan=\"2\">秦淮</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:110px;\" rowspan=\"2\">产品编码</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:150px;\" rowspan=\"2\" >生产企业</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:150px;\" rowspan=\"2\" >备注</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:100px;\" rowspan=\"2\">委员表决票数</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;\" rowspan=\"2\">表决结果</td>\n" +
                            "    </tr>\n" +
                            "    <tr style=\"font-weight: bold;\">\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:150px;\" colspan='3' >淘汰原则</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:320px;\" colspan='4'>绝对优先</td>\n" +
                            "        <td style=\"text-align:center;vertical-align:middle;width:100px;\" colspan='2'>相对优先</td>\n" +
                            "    </tr></thead></table></div><div class='table-body'><table style=\"table-layout: fixed;\"><tbody>";

                        if(data.ShengchanList.length > 0){
                            _this.show = true;
                            _this.Shengchanqiyelist=data.ShengchanList;

                            var PageInfo = data.PageInfo;
                            _this.pageIndex = PageInfo.pageIndex;
                            _this.recordCount = PageInfo.recordCount;
                            _this.pageCount = PageInfo.pageCount;

                            for (var i = 0; i < data.ShengchanList.length; i++) {
                                var mmShengchan = data.ShengchanList[i];

                                var mmPinzhongbinahao=mmShengchan.pinzhongbianhao;
                                var mmyaopinfenlei=mmShengchan.beizhu1;
                                var mmYaopinpingming=mmShengchan.yaopinpinming;



                                var mmPinguiList = mmShengchan.pinguilist;
                                var mmPinzhongHebingshu = mmShengchan.pinzhonghebinghang;

                                for (var j = 0; j < mmPinguiList.length; j++) {
                                    var s=0;

                                    var mmPinguilist = mmPinguiList[j];

                                    var mmPinguixuhao = parseInt(mmPinguilist.pinguixuhao);
                                    var mmYaopinmingcheng = mmPinguilist.yaopinmingcheng;
                                    var mmGuige = mmPinguilist.guige;
                                    var mmDanwei = mmPinguilist.danwei;
                                    var mmYibaoleibie = mmPinguilist.yibaoleibie;
                                    var mmPinguileibie=mmPinguilist.pinguileibie;
                                    var mmJixing=mmPinguilist.jixing;

                                    var mmShengchanqiyeList= mmPinguilist.shengchanqiyelist;
                                    var mmPinguiHebingshu = mmPinguilist.pinguihebinghang;

                                    for (var k = 0; k < mmShengchanqiyeList.length; k++) {
                                        var mmlist = mmShengchanqiyeList[k];
                                        var mmId=mmlist.id;
                                        var mmJianchatongbao = mmlist.jianchatongbao;
                                        var mmWeiguawang = mmlist.weiguawang;
                                        var mmWupeisongqiyehu = mmlist.wupeisongqiye;
                                        var mmYuanguotan = mmlist.yuanguotan;
                                        var mmYizhixingpingjia= mmlist.yizhixingpingjia;
                                        var mmBaomipeifang=mmlist.baomipeifang;
                                        var mmBaohupinzhong=mmlist.baohupinzhong;
                                        var mmJiage = mmlist.jiage;
                                        var mmYuanyan = mmlist.yuanyan;
                                        var mmJiyao = mmlist.jiyao;
                                        var mmJicai = mmlist.jicai;
                                        var mmYuanbenbu = mmlist.yuanbenbu;
                                        var mmQinhuai = mmlist.qinhuai;
                                        var mmChanpinbianma= mmlist.chanpinbianma;
                                        var mmShengchanqiye = mmlist.shengchanqiye;
                                        var mmBeizhu = mmlist.beizhu;
                                        var mmScore = mmlist.score+"/"+_this.usernum;
                                        var mmStatus = mmlist.status;

                                        var mmHuanhangfu = "";
                                        var mmerjihe="";
                                        var mmyijihe="";
                                        var mmsanjihe="";
                                        if (k != 0) {
                                            mmHuanhangfu = "<tr>";
                                        }else{
                                            mmerjihe = "<td style='text-align:center;vertical-align:middle;width: 50px;height: 100%'  rowspan='" + mmPinguiHebingshu + "'>" + mmJixing + "</td>";
                                            mmerjihe += "<td style='text-align:center;vertical-align:middle;width: 50px;height: 100%'  rowspan='" + mmPinguiHebingshu + "'>" + mmPinguixuhao + "</td>";
                                            mmerjihe += "<td style='text-align:center;vertical-align:middle;width: 80px;'  rowspan='" + mmPinguiHebingshu + "'>" + mmYaopinmingcheng + "</td>";
                                            mmerjihe += "<td style='text-align:center;vertical-align:middle;width: 80px;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'  rowspan='" + mmPinguiHebingshu + "'><a title='" + mmGuige + "'>" + mmGuige + "</a></td>";
                                            mmerjihe += "<td style='text-align:center;vertical-align:middle;width: 50px;'  rowspan='" + mmPinguiHebingshu + "'>" + mmDanwei + "</td>";
                                            mmerjihe += "<td style='text-align:center;vertical-align:middle;width: 50px;'  rowspan='" + mmPinguiHebingshu + "'>" + mmYibaoleibie + "</td>";
                                            mmsanjihe = "<td style='text-align:center;vertical-align:middle;width: 50px;'  rowspan='" + mmPinguiHebingshu + "'>" + mmPinguileibie + "</td>";
                                        }
                                        if(j==0 &&s==0){
                                            mmyijihe= "<td style='text-align:center;vertical-align:middle;width: 50px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmPinzhongbinahao + "</td>";
                                            mmyijihe += "<td style='text-align:center;vertical-align:middle;width: 50px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmyaopinfenlei + "</td>";
                                            mmyijihe += "<td style='text-align:center;vertical-align:middle;width: 50px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmYaopinpingming + "</td>";

                                            s= 1;
                                        }

                                        mmHtml +=mmyijihe;
                                        mmHtml +=mmerjihe;

                                        var mmStatusText = "";
                                        if(mmStatus=='0'){
                                            mmStatusText="<div id='div_"+mmId+"_status' style=\"text-align:center;color:red\">不通过</div>";
                                        }
                                        if(mmStatus=='1'){
                                            mmStatusText="<div id='div_"+mmId+"_status' style=\"text-align:center;color:green\">通过</div>";
                                        }

                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_jianchatongbao' style=\"text-align:center;\">" + mmJianchatongbao + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_weiguawang' style=\"text-align:center;\">" + mmWeiguawang + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_wupeisongqiye' style=\"text-align:center;\">" + mmWupeisongqiyehu + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_yuanguotan' style=\"text-align:center;\">" + mmYuanguotan + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_yizhixingpingjia' style=\"text-align:center;\">" + mmYizhixingpingjia + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:50px;white-space:nowrap; -moz-text-overflow: ellipsis;text-overflow: ellipsis; overflow: hidden;'><a id='a_"+mmId+"_baomipeifang' title='" + mmBaomipeifang + "'><div id='div_"+mmId+"_baomipeifang' style=\"text-align:center;text-overflow: ellipsis; overflow: hidden;\">" + mmBaomipeifang + "</div></a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width:50px;'><div id='div_"+mmId+"_baohupinzhong' style=\"text-align:center;\">" + mmBaohupinzhong + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_jiage' style=\"text-align:center;\">" + mmJiage + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_yuanyan' style=\"text-align:center;\">" + mmYuanyan + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_jiyao' style=\"text-align:center;\">" + mmJiyao + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'><div id='div_"+mmId+"_jicai' style=\"text-align:center;\">" + mmJicai + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'>" + mmYuanbenbu + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'>" + mmQinhuai + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 110px;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a id='a_"+mmId+"_chanpinbianma' title='" + mmChanpinbianma + "'><div id='div_"+mmId+"_chanpinbianma' style=\"text-align:center;text-overflow: ellipsis; overflow: hidden;\">" + mmChanpinbianma + "</div></a></td>";
                                        // mmHtml += "<td style='text-align:center;vertical-align:middle;width: 50px;'>" + mmChanpinbianma + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 150px;'><div id='div_"+mmId+"_shengchanqiye' style=\"text-align:center;\">" + mmShengchanqiye + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 150px;'><div id='div_"+mmId+"_beizhu' style=\"text-align:center;\">" + mmBeizhu + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;width: 100px;'><div id='div_"+mmId+"_score' style=\"text-align:center;\">" + mmScore + "</div></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;'>" + mmStatusText + "</td>";
                                        mmHtml += "</tr>";
                                    }
                                }
                            }
                        }else {
                            _this.show = false;
                        }
                        mmHtml += "</table>";
                        $("#List").html(mmHtml);
                    }else{
                        layer.alert(ppData.message);
                    }
                }

            },"json");
        },

    },
    watch :{
        //监控分页情况，刷新列表
        pageIndex : function(){

            this.bindHuizongbiaoList();
        }
    }
})